package com.ebeijia.web.controller;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ebeijia.mybatis.pojo.ComplaintSuggInfo;
import com.ebeijia.service.user.ComplainSuggService;
import com.ebeijia.util.LoggerUtil;
import com.ebeijia.web.ResponseMessage;

@Controller
@RequestMapping("/complainSugg")
public class ComplainSuggController {
	@Autowired
	private ComplainSuggService comPlainSuggService;

	/**
	 * 投诉和建议 添加
	 * 
	 * @param comPlainSugg
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/submitComSuggest")
	public ResponseMessage submitComSuggest(ComplaintSuggInfo comPlainSugg,
			HttpServletRequest request) {
		// 获取内容和 类型
		comPlainSugg.setCreateDate(new Date());
		comPlainSugg.setBusiStatus("01");// 01 待处理
		if(StringUtils.isEmpty(comPlainSugg.getBusiContent())){
			return ResponseMessage.error("受理内容不可以为空");
		}
		int conn = comPlainSuggService.submitComSuggest(comPlainSugg);
		if (conn != 0) {
			String success = "受理成功";
			return ResponseMessage.success(success);
		}
		return ResponseMessage.error();
	}

}
